<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document对象</title>
</head>
<body>
<input type="text" name="username">
</body>

<script>
    let ele_name = document.getElementsByName("username");
    alert(ele_name.length)
</script>

</html>